package com.sjksy.demo.mapper;

import com.sjksy.demo.domain.CustomerInformation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.relational.core.sql.In;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;

/**
* @author guyueyuan
* @description 针对表【customer_information】的数据库操作Mapper
* @createDate 2024-12-11 15:37:02
* @Entity com.sjksy.demo.domain.CustomerInformation
*/
@Repository
@Mapper
public interface CustomerInformationMapper extends BaseMapper<CustomerInformation> {

    /**
     * 根据顾客id获取顾客消费金额（service层应该有更详细的信息获取）
     * */

    @Select("select money from customer_information as ci " +
            "left join travel_message as tm " +
            "on ci.travel_id = tm.travel_id " +
            "left join travel_contract as tc " +
            "on tc.travel_contract_id=tm.travel_contract_id " +
            "where ci.customer_id=#{customerId}")
    BigDecimal getMoneyByCustomerId(Integer customerId);
}




